package clue.engine2;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Set;

import clue.board.Board;
import clue.board.Square;
import clue.cards.Card;
import clue.enums.Room;
import clue.players.Player;
import clue.players2.Player2;

/**
 *
 * @author Shawn
 */
public class GameState2 {
	private HashMap<Player2, Set<Card>> playerHands;
	private HashMap<Player2, Integer> playerToID;
	public List<Integer> playerIDs;
	public HashMap<Integer, Room> IDToLocation;
	public HashMap<Integer, Square> IDToSquare;
	public Board board;
	
	GameState2(
	  Player2[] players,
	  Board board,
	  HashMap<Player2, Room> playerLocation,
	  HashMap<Player2, Square> playerSquare,
	  HashMap<Player2, Set<Card>> hands,
	  HashMap<Player2, Integer> playerToID) {
		playerIDs = new ArrayList<>();
		IDToLocation = new HashMap<>();
		IDToSquare = new HashMap<>();
		for (Player2 p : players) {
			Integer i = playerToID.get(p);
			playerIDs.add(i);
			IDToLocation.put(i, playerLocation.get(p));
			IDToSquare.put(i, playerSquare.get(p));
		}
		
		this.playerToID = playerToID;
		playerHands = hands;
		this.board = board;
	}
	
	public Set<Card> getOwnHand(Player2 p) {
		if (playerHands.containsKey(p))
			return playerHands.get(p);
		return null;
	}
	
	public Integer getOwnID(Player2 p) {
		if (playerToID.containsKey(p))
			return playerToID.get(p);
		return null;
	}
}
